<template>
	<view class="login">
		<button open-type="getUserInfo" @getuserinfo="getUserInfo">立即登录</button>
	</view>
</template>

<script>
	export default {
		data(){
			return {
				loginInfo:{}
			}
		},
		methods:{
			getUserInfo(res){
				// console.log(this)
				this.loginInfo.encryptedData = res.detail.encryptedData
				this.loginInfo.rawData = res.detail.rawData
				this.loginInfo.iv = res.detail.iv
				this.loginInfo.signature = res.detail.signature
				uni.login({
					success: async res1 => {
						console.log(res1)
						this.loginInfo.code = res1.code
						console.log(this.loginInfo)
						const res2 = await this.$http({
							method:'post',
							url:'/users/wxlogin',
							data:this.loginInfo
						})
						console.log(res2)
					}
				})
			}
		}
	}
</script>

<style>
</style>
